<html>
<script src="../../../resources/js-test.js"></script>
<body>
<iframe style="position:absolute; top:100px; left:100px;" src="./resources/touch-inside-iframe-scrolled2.html"></iframe>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
description('Test iframes receive touches correctly when scrolled. https://bugs.webkit.org/show_bug.cgi?id=96541');

var touch = null;
var correctDiv = false;

function testComplete(hitCorrectDiv, event)
{
    correctDiv = hitCorrectDiv;
    shouldBeTrue("correctDiv");
    
    touch = event.touches[0];
    shouldBe("touch.pageX", "150");
    shouldBe("touch.pageY", "350");
    
    isSuccessfullyParsed();
    testRunner.notifyDone();
}

// Backstop to prevent test timeout on incorrect position
document.addEventListener('touchstart', function(event) { 
  parent.testComplete(false, event);
}, false);

function runTest() {
    if (window.eventSender) {
        // Touch the center of the div in the iframe.
        // 100px is offset to iframe in main frame,
        // 2px for the iframe border, 50px to get to centre of the div.
        eventSender.addTouchPoint(152, 152);
        eventSender.touchStart();
    } else {
       debug('This test requires DRT.');
    }
}

if (window.testRunner) {
    testRunner.waitUntilDone();
}
</script>
</body>
</html>
